<?php
/**
 * Account API
 *
 * Provides access and CRUD mechanism for accounts.
 *
 * @author Terence Yan <terence.yan@me.com>
 */
 
 //Note from Vicky: Depending on your directory, these two lines may need to be changed
 
require_once(__DIR__.'/CommonClass/errorcode.php');
require_once(__DIR__.'/account.controller.php');

/**
 * Read all accounts under authorizing user
 * @param $authUsername
 * @param $authPass
 * @return array success error code, alt. user and hash strings
 */
function getAccounts($authUsername, $authPass) {
    if (empty($authUsername)) {
        return array(ErrorCode::failRead + 100);
    }
    if (empty($authPass)) {
        return array(ErrorCode::failRead + 200);
    }

    $controller = new AccountController();
    if(!($controller -> authenticateValidator($authUsername, $authPass))){
        return array(ErrorCode::authFailRead);
    }
    return $controller ->requestHandler(array()
    );

}

?>